package schema

import (
	"entgo.io/ent"
	"entgo.io/ent/dialect/entsql"
	"entgo.io/ent/schema"
	"entgo.io/ent/schema/field"
	"entgo.io/ent/schema/index"
	"time"
)

// HzIntegralWallet holds the schema definition for the HzIntegralWallet entity.
type HzIntegralWallet struct {
	ent.Schema
}

// Fields HzIntegralWallet Fields of the HzIntegralWallet.
func (HzIntegralWallet) Fields() []ent.Field {
	return []ent.Field{
		field.Int64("user_id").Comment("用户ID"),
		field.Int64("wallet_active_balance").Default(0).Comment("钱包活期余额（百分之一）"),
		field.Int64("wallet_freeze_balance").Default(0).Comment("钱包积分冻结余额（百分之一）"),
		field.Int64("created_at").Immutable().Optional().Comment("创建时间"),
		field.Int64("update_at").Default(time.Now().Unix()).Comment("更新时间"),
		field.Int64("delete_at").Optional().Comment("删除时间"),
	}
}

// Indexes of the Street.
func (HzIntegralWallet) Indexes() []ent.Index {
	return []ent.Index{
		index.Fields("user_id").Unique(),
	}
}

func (HzIntegralWallet) Annotations() []schema.Annotation {
	return []schema.Annotation{
		entsql.WithComments(true),
		schema.Comment("积分钱包表"),
	}
}
